<template>
  <div>
    <div class="container">
      <div class="content">
        <div class="content_left">
          <div class="content_left_info">
            <router-view></router-view>
          </div>
          <div class="no_data">暂无更多数据</div>

        </div>
        <div class="content_right">
          <section class="content_right_info">
            <InfoLink></InfoLink>
          </section>
          <section>
            <HotArticle></HotArticle>
          </section>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import InfoLink from '@/components/InfoLink/index';
import Article from '@/components/Article/index';
import HotArticle from '@/components/HotArticle/index'
import Comment from '@/components/Comment/index'
import { mapState } from 'vuex';

export default {
  name: 'container',
  created() {
    this.getArticleList();
    this.getHotArticle();
  },
  data(){
    return{
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        categoryId: 0
      },
    }
  },
  methods:{
    async getArticleList(){
      const {queryParams}=this;
      try {
        let result=await this.$store.dispatch('getArticleList',queryParams)
      }catch (e){
        console.log(e)
      }

    },
    async getHotArticle(){
      try {
        await this.$store.dispatch("getHotArticle");
      }catch (e){
        console.log(e)
      }
    }
  },
  components: {
    InfoLink,
    Article,
    HotArticle,
    Comment
  },
  computed:{
    ...mapState({
      articleList:state=>state.home.articleList
    })
  }
}
</script>

<style scoped>
.container {
  max-width: 80%;
  margin: 0 auto;
  margin-top: 40px;
  margin-bottom: 50px;
}

.content {
  position: relative;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}

.content_left {
  width: 60%;
  text-align: center;
}
.content_left_info {
  border-radius: 10px;
  margin-bottom: 30px;

}

.no_data {
  background: #97dffd;
  color: #fff;
  cursor: pointer;
}

.content_right {
  width: 36%;
}

section {
  padding: 10px;
  background: #fff;
  width: 100%;
  /*text-align: center;*/
  margin-bottom: 25px;
  border-radius: 10px;
}

.content_right_info:hover {
  box-shadow: 5px 5px 5px #888888;
  transition: all 0.5s linear;
}
@media all and (max-width: 450px) {
  .content {
    flex-direction: column;
  }

  .container {
    max-width: 90%;
  }

  .content_left {
    width: 100%;
  }

  .content_right {
    width: 100%;
  }

  .content_left_info img {
    max-height: 200px;
  }
}
</style>